﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace 数字华容道
{
    /// <summary>
    /// 棋子.xaml 的交互逻辑
    /// </summary>
    public partial class 棋子 : UserControl
    {
        public static readonly DependencyProperty 编号Property =
            DependencyProperty.Register(
                nameof(编号),
                typeof(int),
                typeof(棋子));

        public int 编号
        {
            get => (int)GetValue(编号Property);
            set
            {
                SetValue(编号Property, value);
                棋子编号.Text = value.ToString();
            }
        }

        public int FontSizeEx
        {
            get => (int)棋子编号.FontSize;
            set => 棋子编号.FontSize = value;
        }

        public static readonly DependencyProperty 边框颜色Property =
            DependencyProperty.Register(
                nameof(边框颜色),
                typeof(Brush),
                typeof(棋子),
                new PropertyMetadata(default(Brush)));

        public Brush 边框颜色
        {
            get => (Brush)GetValue(边框颜色Property);
            set
            {
                SetValue(边框颜色Property, value);
                边框和背景色.BorderBrush = value;
            }
        }

        public Point 当前位置 { get; set; }

        public 棋子()
        {
            InitializeComponent()
                ;
        }

        private void Border_MouseEnter(object sender, MouseEventArgs e)
        {
            Trace.WriteLine(((Border)sender).IsMouseOver);
        }

        private void Border_Loaded(object sender, RoutedEventArgs e)
        {
            Trace.WriteLine(((Border)sender).IsMouseOver);
        }
    }
}
